package com.hdaccp.gymxmjpa.Controller;




import com.hdaccp.gymxmjpa.Dao.AdminuserDao;
import com.hdaccp.gymxmjpa.entity.Adminuser;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/dl")
public class AdminuserConntroller {
    @Autowired
    private AdminuserDao adminuserDao;


   @RequestMapping("/yz")
    public String login(String username, String password,HttpSession httpSession,Model model){
           Adminuser a= adminuserDao.findByAdminNameAndAdminmima(username,password);
            if(a!=null){
                httpSession.setAttribute("user",a);
                return "WEB-INF/jsp/index" ;
            }
            model.addAttribute("mag","账号或密码错误");
        return "login";
    }
}
